/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {TreeNode} root
 * @param {number} k
 * @return {boolean}
 */
 var findTarget = function(root, k) {
  let map = new Array(20001).fill(false);
  let stack = [root];
  while(stack.length !== 0 ) {
      let n = stack.pop();
      if(map[k - n.val + 10000]) return true;
      if(n.left) stack.push(n.left);
      if(n.right) stack.push(n.right);
      map[n.val + 10000] = true;
  }
  return false;
};